package com.chen.Dome8Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ThreadTest {
    public static void main(String[] args) {
        //目标：完成多线程的综合案例
        //红包雨游戏：共有一百名员工工号为1.2.3.4~~~~100，
        //公司共计发出200个红包，小红包在1-30占比80% 大红包在31-100 占比20%，

        List<Integer> list = prepareMoney();
        //定义线程类
        for(int i=1;i<=100;i++) {
            PeopleGetRedMoney pg = new PeopleGetRedMoney(list,"人"+i);
            pg.start();
        }


    }
    //准备200个红包，装进List集合
    public static List<Integer> prepareMoney(){
        List<Integer> list = new ArrayList<>();
        Random r = new Random();
        for (int i = 1; i <=160; i++) {
            int money = r.nextInt(30)+1;
           list.add(money);
        }
        for(int i=1;i<=40;i++) {
            int money = r.nextInt(70)+31;
            list.add(money);
        }
        return list;
    }
}
